package com.caiyi.financial.nirvana.sms.controller;


import com.caiyi.financial.nirvana.sms.querybean.MsgDayQueryBean;
import com.caiyi.financial.nirvana.sms.querybean.MsgMonthQueryBean;
import com.caiyi.financial.nirvana.sms.querybean.SendCountQueryBean;
import com.caiyi.financial.nirvana.sms.service.SmsMsgService;
import com.youyu.common.api.Result;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description = "发送统计")
@CrossOrigin
@RestController
@RequestMapping("sms/msgCount")
public class MsgCountController extends BaseController {

    @Autowired
    private SmsMsgService msgService;


    @ApiOperation(value = "客户日发送统计", notes = "客户日发送统计")
    @ApiResponses({@ApiResponse(code = 0000, message = "成功", response = SendCountQueryBean.class),
            @ApiResponse(code = 9999, message = "失败", response = String.class)})
    @PostMapping("/getAccountMsgByDayByParams")
    public Result getMsgByDayByAccount(@RequestBody @ApiParam(name = "bean", value = "客户日统计查询参数", required = true) MsgDayQueryBean bean) {
        bean.setAccount(smsUser.getAccount());
        return Result.ok(msgService.getMsgByDayByAccount(bean));
    }

    @ApiOperation(value = "客户月发送统计", notes = "客户月发送统计")
    @ApiResponses({@ApiResponse(code = 0000, message = "成功", response = SendCountQueryBean.class),
            @ApiResponse(code = 9999, message = "失败", response = String.class)})
    @PostMapping("/getAccountMsgByMonthByParams")
    public Result geMsgByMonthAccount(@RequestBody @ApiParam(name = "bean", value = "客户月统计查询参数", required = true) MsgMonthQueryBean bean) {
        bean.setAccount(smsUser.getAccount());
        return Result.ok(msgService.getMsgByMonthByAccount(bean));
    }
}
